The continued increase in data storage has been accompanied by an increasing need to have an accurate record of the state of particular data stores at specified times. A snapshot is a point-in-time image of a given data store. Snapshots may be created to effect recovery of data upon a catastrophic failure or to maintain a record of the state of the data at given times. Typical data storage systems may have a capacity of a terabyte (TB) or more. Such storage may be organized as a number of storage units of more practical size known as virtual logical units (VLUs). VLUs have their own well-defined virtual block address (VBA) space, and typically range in size upward from several hundred megabytes (MB). A snapshot may be created for an original VLU (parent VLU) at a user-specified time. The snapshot VLU (child VLU) then contains an exact copy of the parent VLU at the specified time. This child VLU can be accessed and modified just like any other VLU.
One typical approach to creating a snapshot is to make an actual copy of the entire VLU. For example, upon receiving a command to snapshot a VLU, all new data access requests (I/O requests—reads and WRITEs) to that VLU are halted, a child VLU of the same size is created, and the entire content of the parent VLU is copied into the child VLU. Both VLUs are then available to the user. Copying the contents of one VLU to another to create a snapshot is both time-consuming and an inefficient use of storage space. For example, a 1 TB VLU may require several hours or even days to completely copy during which time the parent VLU is unavailable for data access. Moreover, the storage space required for the child VLU is equal to the size of the parent VLU.
A variant of this approach is for the system to initiate a background copying operation when the snapshot command is received without accepting new data access requests. In such a system, when a WRITE/READ operation is received, the system first checks to see if the requested data block has already been copied into the child VLU. If the block has not yet been copied to the child VLU, the system explicitly makes the copy before allowing the requested operation to be serviced. A bitmap may be used to keep track of the data blocks that have been copied. This approach alleviates the problem of the VLU being inaccessible for long periods, but is still space inefficient.
A typical data storage system contains an array of disk drives, a controller for controlling access to the disk array, and a cache memory for storing recently accessed data so as to provide quick access to data that is likely to be accessed in the near-term without having to access the disk on every occasion. Since a particular file or block of data may be located on the disk or in the cache, the storage device typically includes metadata (MD) that registers all data blocks currently in the cache and, therefore, indicates whether a data block is on the disk or stored in cache. If the data block is in the cache, the MD indicates where the data block is stored in the cache. The MD may also indicate the current state of the data block (e.g., whether or not it has been “flushed” to disk). For such a system, another typical approach to creating a snapshot is to create a copy of the MD of the parent VLU when the snapshot command is received. The new copy of MD is then assigned to the child VLU. With this approach, data access to the parent VLU is interrupted only long enough to make a copy of the MD. That is, because both copies of the MD point to the same data, the child VLU presents an image that is identical to the parent VLU immediately after the MD is copied. Thus both the parent VLU and the child VLU can be made available to the user as soon as the MD is copied. Subsequently, if a WRITE is received for either VLU, the system checks to see if the MD of the child VLU and the MD of the parent VLU for the corresponding VBA are still pointing to the same data blocks. If not, the WRITE operation proceeds normally. Otherwise, a copy of the data block involved is made, and linked into the metadata for the child VLU before the WRITE operation is permitted to proceed. A bitmap or scoreboard may be used to keep track of the blocks that have been copied. Alternatively, the MD need not be entirely copied when the snapshot command is received. Instead, space for the MD and the bitmap is allocated, but left empty. A cleared ‘copied’ bit implicitly indicates that a corresponding MD entry in the child VLU is identical to that in the parent VLU. A MD entry for the child VLU is filled in only when the corresponding data block is copied. With such an approach, the time during which data access is interrupted is reduced because only a relatively small amount of information (i.e., the MD) is copied before the VLUs are made available to the user again. Copying only the MD also has the advantage of needing only as much new disk storage space as the amount of changes made to the VLUs after the snapshot is created. However, since each snapshot requires a complete copy of the metadata, this approach has a major drawback where snapshots of the same VLU are required frequently. Frequent snapshot commands imply that the differences in data content between consecutive snapshots are small, and that the number of snapshots that the system must support is large. Because the MD structure is usually stored in non-volatile memory (NVRAM), which is a limited resource in a storage array, an array may quickly exhaust available NVRAM, and be unable to create snapshots until previous snapshots are deleted. Since space for the MD structure is allocated when the snapshot command is first received, delayed copying as discussed above does not alleviate the problem of limited NVRAM. Moreover, some MD structures are large enough that the times to copy only MD structure is prohibitive.